package cn.iocoder.yudao.module.ao.dal.mysql.majordirection;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.majordirection.MajorDirectionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.majordirection.vo.*;

/**
 * 专业方向 Mapper
 *
 * @author lfl
 */
@Mapper
public interface MajorDirectionMapper extends BaseMapperX<MajorDirectionDO> {

    default List<MajorDirectionDO> selectList(MajorDirectionListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MajorDirectionDO>()
                .eqIfPresent(MajorDirectionDO::getMajorId, reqVO.getMajorId())
                .likeIfPresent(MajorDirectionDO::getDirectionName, reqVO.getDirectionName())
                .eqIfPresent(MajorDirectionDO::getDirectionCode, reqVO.getDirectionCode())
                .eqIfPresent(MajorDirectionDO::getDescription, reqVO.getDescription())
                .eqIfPresent(MajorDirectionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MajorDirectionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MajorDirectionDO::getId));
    }

	default MajorDirectionDO selectByMajorIdAndDirectionName(Long majorId, String directionName) {
	    return selectOne(MajorDirectionDO::getMajorId, majorId, MajorDirectionDO::getDirectionName, directionName);
	}

    default Long selectCountByMajorId(Long majorId) {
        return selectCount(MajorDirectionDO::getMajorId, majorId);
    }

}